@import '../../../../components/style/themes/default';

@table-prefix-cls: ~'@{c7n-pro-prefix}-table';
@table-border: @border-width-base @border-style-base @table-border-color;
@table-row-search-bg: @table-row-group-title-bg;

.@{table-prefix-cls} {
  &-query-bar {
    float: right;

    > * + * {
      margin-left: 0.16rem;
    }

    &-dirty-info {
      display: inline-block;
      height: @input-height-base;
      padding: 0 0.12rem;
      line-height: 2;
      vertical-align: middle;
      background-color: @background-color-light;
      border-radius: @border-radius-base;

      > * {
        vertical-align: middle;

        & + * {
          margin-left: 0.05rem;
        }
      }

      .@{iconfont-css-prefix} {
        color: @yellow-6;
      }
    }

    input {
      font-weight: 500;
    }
  }

  // advanced-query-bar

  &-advanced-query-bar {
    padding: 0.12rem 0;

    &-button {
      display: inline-block;
      vertical-align: middle;
    }

    &-options .@{table-prefix-cls}-filter-select {
      padding-right: 0 !important;
      padding-left: 1.2rem !important;
      border-top-style: dashed !important;
      cursor: default;

      &-prefix {
        width: 1.2rem;
        line-height: 1.5;
        text-align: left;
      }
    }

    &-options .@{table-prefix-cls}-filter-select-hidden {
      display: none;
    }
  }

  // dynamic-filter-bar

  &-dynamic-filter-bar {
    margin-bottom: 0.08rem;

    input::-webkit-input-placeholder {
      color: #6A6A6A;
    }

    input:-moz-placeholder {
      color: #6A6A6A;
    }

    input::-moz-placeholder {
      color: #6A6A6A;
    }

    input:-ms-input-placeholder {
      color: #6A6A6A;
    }

    .@{c7n-pro-prefix}-input-number-placeholder, .@{c7n-pro-prefix}-select-placeholder {
      color: #6A6A6A;
    }
  }

  &-dynamic-filter-single-wrapper {
    display: flex;
  }

  &-dynamic-filter-bar-single-action {
    display: flex;
    flex-shrink: 0;
    gap: 0.08rem;
    justify-content: flex-end;
    margin: 0.08rem 0 0;
    padding-right: 0.06rem;
    background: rgba(232, 232, 232, 0.20);

    i {
      margin-top: 0.06rem;
      font-size: 0.2rem;
    }

    .@{table-prefix-cls}-filter-buttons {
      margin-top: 0.02rem;
    }
  }

  &-dynamic-filter-bar-suffix {
    gap: 0.08rem;
    margin-left: 0.1rem;

    .@{table-prefix-cls}-columns-chooser {
      width: unset;
      border-left: none;

      &-dropdown-menu {
        min-width: 1.8rem;
      }
    }
  }

  &-dynamic-filter-bar-prefix {
    gap: 0.08rem;

    .@{table-prefix-cls}-columns-chooser {
      width: unset;
      border-left: none;

      &-dropdown-menu {
        min-width: 1.8rem;
      }
    }
  }

  &-dynamic-filter-toolbar {
    margin-left: auto;
  }

  &-dynamic-filter-buttons-toolbar {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    margin-bottom: 0.08rem;

    .@{table-prefix-cls}-summary-group-wrapper {
      margin: 0 auto 0 0;
    }
  }

  &-filter-menu {
    display: flex;
    align-items: center;

    .@{c7n-pro-prefix}-select {
      display: inline-block;
      max-width: 1.72rem;
      margin: 0;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
      border: none;
    }

    &-query {
      margin-right: 0.08rem;
    }

    &-expand, &-query {
      cursor: pointer;

      i {
        font-size: 0.16rem;
        background-color: #fafafa;
        border-radius: 0.02rem;
      }
    }
  }

  &-filter-content {
    position: relative;
    display: flex;
    flex-shrink: 0;
    margin-right: 0.16rem;
    padding-left: 0.08rem;
    cursor: pointer;

    &:focus-within,
    &:hover {
      background-color: rgba(0, 0, 0, .05);
      border-radius: 0.02rem;

      .@{table-prefix-cls}-filter-item-close {
        display: inline-block !important;
      }
    }
  }

  &-filter-wrapper {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    margin: 0.08rem 0 0;
    padding: 0.01rem 0.06rem;
    background: rgba(232, 232, 232, 0.20);
    border-radius: 0.01rem;

    span, input {
      background-color: transparent;
    }
  }

  &-add-fields {
    display: flex;
    align-items: center;
    padding: 0 0.08rem;
    color: @text-color;
    cursor: pointer;

    &:hover {
      background-color: rgba(0, 0, 0, .05);
      border-radius: 0.02rem;
    }
  }

  &-filter-buttons {
    display: flex;
    flex-shrink: 0;
    gap: 0.08rem;

    button:first-child {
      margin-left: 0.16rem;
    }
  }

  &-filter-status {
    width: 0.38rem;
    height: 0.16rem;
    margin: 0 0.12rem;
    padding: 0;
    color: #20D489;
    text-align: center;
    background: rgba(32, 212, 137, 0.12);
    border: none;
    border-radius: 0.02rem;

    span {
      display: block;
      font-size: 0.12rem;
      line-height: 0.16rem;
      transform: scale(0.8);
    }
  }

  &-filterName-select {
    max-width: 1.72rem;
    margin-left: 0.12rem;
    border: none;
  }

  &-filter-menu-option {
    display: flex;

    &-content {
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }

    .@{c7n-prefix}-tag {
      height: 0.2rem;
      margin: 0 0.04rem;
    }

    &:hover &-icons {
      display: inline-flex;
      margin-left: auto;
    }

    &:hover &-selected {
      display: none;
    }

    &-icons {
      display: none;
      height: 0.2rem;
      color: @primary-color;
      font-size: 0.16rem;
    }

    &-selected {
      display: inline-flex;
      margin-left: auto;
      font-size: 0.16rem;
    }
  }

  &-filter-label {
    display: flex;
    align-items: center;
    margin-right: 0.02rem;
    padding-top: 0.005rem;
    color: #6A6A6A;
    font-size: 0.12rem;
  }

  &-filter-search {
    color: #A4A4A4;
    font-weight: 400;
    font-size: 0.12rem;

    i {
      height: 0.2rem;
      font-size: 0.16rem;
      line-height: 0.2rem;

      &:hover {
        color: @primary-color;
      }
    }

    &-divide {
      width: 0.01rem;
      height: 0.12rem;
      margin: 0 0.16rem;
      background-color: #DBE1F1;
    }
  }

  &-filter-item {
    display: flex;
    align-items: center;
    font-size: 0.12rem;

    &:focus-within {
      input {
        min-width: 1.34rem !important;
      }
    }

    label {
      input::-webkit-input-placeholder { // 谷歌
        color: rgba(0, 0, 0, .25);
      }

      input:-moz-placeholder { //火狐
        color: rgba(0, 0, 0, .25);
      }

      input::-moz-placeholder {
        color: rgba(0, 0, 0, .25);
      }

      input:-ms-input-placeholder { //微软
        color: rgba(0, 0, 0, .25);
      }

      .@{c7n-pro-prefix}-input-number-placeholder, .@{c7n-pro-prefix}-select-placeholder {
        color: rgba(0, 0, 0, .25);
      }
    }

    i {
      font-size: 0.15rem;
      line-height: 0.2rem;
    }

    &-close {
      position: absolute;
      top: -0.07rem;
      right: -0.07rem;
      z-index: 2;
      display: none !important;
      color: rgba(32, 45, 64, .3);
      cursor: pointer;

      &:hover {
        color: #6A6A6A;
      }
    }

    .@{c7n-pro-prefix}-input-number-plus, .@{c7n-pro-prefix}-input-number-minus {
      height: 0.14rem;
      line-height: 0.14rem;
    }

    .@{c7n-pro-prefix}-checkbox-inner {
      top: 0.08rem;
      width: 0.12rem;
      height: 0.12rem;

      &::after {
        width: 0.05rem;
        height: 0.1rem;
      }
    }

    .@{c7n-pro-prefix}-select-trigger {
      font-size: 0.15rem;
    }

    .@{c7n-pro-prefix}-select, .@{c7n-pro-prefix}-input, .@{c7n-pro-prefix}-input-number, .@{c7n-pro-prefix}-calendar-picker {
      width: auto;
      min-width: unset;
      max-width: 4rem;
      margin: 0;
      padding: 0.02rem;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
      border: none;

      &-required {
        background-color: #fff;

        & > label {
          align-items: center;
        }

        & > label::before { // 谷歌
          display: inline-block;
          width: .08rem;
          margin-left: .04rem;
          color: #d50000;
          font-family: SimSun, sans-serif;
          //line-height: 1;
          vertical-align: middle;
          content: "*";
        }

        .@{c7n-pro-prefix}-input-number-placeholder, .@{c7n-pro-prefix}-select-placeholder {
          &::before {
            display: inline-block;
            width: .08rem;
            margin-left: .04rem;
            color: #d50000;
            font-family: SimSun, sans-serif;
            //line-height: 1;
            vertical-align: middle;
            content: "*";
          }
        }
      }

      &-multiple {
        & > label::before { // 谷歌
          content: "";
        }
      }

      &-invalid {
        input::-webkit-input-placeholder { // 谷歌
          color: @error-color;
        }

        input:-moz-placeholder { //火狐
          color: @error-color;
        }

        input::-moz-placeholder {
          color: @error-color;
        }

        input:-ms-input-placeholder { //微软
          color: @error-color;
        }

        .@{c7n-pro-prefix}-input-number-placeholder, .@{c7n-pro-prefix}-select-placeholder {
          color: @error-color;
        }
      }
    }

    .@{c7n-pro-prefix}-select-multiple-block > div:not(:last-child) {
      max-width: calc(100% - 0.2rem);
    }

    .@{c7n-pro-prefix}-input-number-multiple-block > div:not(:last-child) {
      max-width: calc(100% - 0.2rem);
    }

    .@{c7n-pro-prefix}-select,
    .@{c7n-pro-prefix}-input,
    .@{c7n-pro-prefix}-input-number,
    .@{c7n-pro-prefix}-calendar-picker,
    .@{c7n-pro-prefix}-cascader {
      & > ul {
        flex-wrap: nowrap;
      }

      &-multiple-block-more {
        overflow: visible;
      }
    }
  }

  // professional-query-bar

  &-professional-query-bar {
    display: flex;
    padding: 0.06rem 0;

    .@{c7n-pro-prefix}-field-label, .@{c7n-pro-prefix}-field-wrapper {
      .@{c7n-pro-prefix}-checkbox-wrapper {
        height: @input-height-base;
      }
    }

    &-button {
      display: inline-flex;
      flex-grow: 1;
      flex-shrink: 0;
      align-items: flex-start;
      justify-content: flex-end;
      padding: 0.1rem 0 0.1rem 0.7rem;

      span {
        vertical-align: baseline;
      }
    }
  }

  &-professional-toolbar {
    .@{table-prefix-cls}-toolbar {
      display: flex;
      flex-direction: row-reverse;
      justify-content: space-between;
      padding-bottom: 0.1rem;
      overflow: hidden;

      &-button-group {
        display: inline-flex;
        align-items: center;
      }

      .@{table-prefix-cls}-summary-group-wrapper {
        margin: 0;
      }
    }
  }

  // combo-bar

  &-combo-toolbar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    height: 0.3rem;
    margin-bottom: 0.08rem;

    &-select {
      width: 1.6rem;
      margin: -0.01rem -0.06rem;
    }

    &-fold-icon {
      position: absolute;
      right: 0.16rem;
      cursor: pointer;
    }

    &-action-button {
      margin: 0 0.16rem 0 0;
      padding: 0.04rem;
      background: @table-row-search-bg;
      border: 0;

      &:hover {
        background: #e8e8e8;
      }
    }

    &-action-menu {
      .c7n-menu-submenu-title {
        min-width: 1.2rem;
        padding-left: 0.16rem;
      }
    }

    &-filter {
      display: flex;
      align-items: center;

      > span {
        margin-right: 0.04rem;
        color: #595959;
        font-size: 0.14rem;
        line-height: 0.22rem;
      }

      &-title {
        margin-right: 0.16rem;

        &:first-child {
          margin-left: 0;
        }

        color: rgba(0, 0, 0, 0.85);
        font-weight: 400;
        font-size: 14px;
        line-height: 22px;
      }

      &-buttons {
        flex-shrink: 0;
        margin-right: 0.16rem;
      }

      .toolbar-icon {
        width: 0.16rem;
        height: 0.16rem;
        margin-right: 0.16rem;
        color: rgba(0, 0, 0, 0.65);
        cursor: pointer;

        &:hover,
        &.active {
          color: @primary-color;
        }
      }
    }

    &-fold {
      position: absolute;
      right: 0;
      cursor: pointer;
      transition: all @animation-duration-slow @ease-in-out-circ;

      &:hover,
      &.active {
        color: @primary-color;
      }
    }
  }

  &-thead-inline-search {
    padding-bottom: 0.01rem;
    background-color: @table-row-search-bg;
    border-bottom: @table-border;
  }

  &-thead-inline-search-last {
    box-shadow: -@border-width-base 0 0 @table-border-color;
  }

  &-inline-query {
    cursor: pointer;
  }

  &-fold {
    display: none;
  }
}
